
/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
package view;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.WindowConstants;

import controler.SistemaIndumentaria;

public class AltaProveedor extends javax.swing.JFrame {
	private static final long serialVersionUID = 1L;

	private static AltaProveedor instAltaProveedor;
	private JLabel jLabel1;
	private JLabel jLabel2;
	private JLabel jLabel3;
	private JLabel jLabel4;
	private JTextField jTextTelefono;
	private JTextField jTextRazonSocial;
	private JButton jBCancelar;
	private JButton jBAceptar;
	private JTextField jTextDireccion;
	private JTextField jTextCuit;

	private JLabel jLabelid;

	private JTextField jTextIdProveedor;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		AltaProveedor inst = new AltaProveedor();
		inst.setVisible(true);
	}
	
	private AltaProveedor() {
		super();
		initGUI();
	}
	
	public static AltaProveedor getInstance(boolean init)
	{
		if (instAltaProveedor==null)
		{
			instAltaProveedor= new AltaProveedor();
			
		}
		if (init)
		{
			instAltaProveedor.inicializarPantalla();
		}
		return instAltaProveedor;
		
	}
	
	
	
	private void initGUI() {
		try {
			
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			this.setTitle("ALTA DE PROVEEDORES");
			{
				jLabelid = new JLabel();
				getContentPane().add(jLabelid);
				jLabelid.setText("ID PROVEEDOR");
				jLabelid.setBounds(49, 7, 63, 21);
			}
			{
				jLabel1 = new JLabel();
				getContentPane().add(jLabel1);
				jLabel1.setText("CUIT");
				jLabel1.setBounds(49, 21, 63, 21);
			}
			{
				jLabel2 = new JLabel();
				getContentPane().add(jLabel2);
				jLabel2.setText("DIRECCION");
				jLabel2.setBounds(49, 84, 63, 28);
			}
			{
				jLabel3 = new JLabel();
				getContentPane().add(jLabel3);
				jLabel3.setText("TELEFONO");
				jLabel3.setBounds(49, 52, 63, 28);
			}
			{
				jLabel4 = new JLabel();
				getContentPane().add(jLabel4);
				jLabel4.setText("EMPRESA");
				jLabel4.setBounds(49, 120, 63, 28);
			}
			{
				jTextIdProveedor = new JTextField();
				getContentPane().add(jTextIdProveedor);
				jTextIdProveedor.setBounds(112, 7, 70, 21);
			}
			{
				jTextCuit = new JTextField();
				getContentPane().add(jTextCuit);
				jTextCuit.setBounds(112, 21, 70, 21);
			}
			{
				jTextTelefono = new JTextField();
				getContentPane().add(jTextTelefono);
				jTextTelefono.setBounds(112, 56, 224, 21);
			}
			{
				jTextDireccion = new JTextField();
				getContentPane().add(jTextDireccion);
				jTextDireccion.setBounds(112, 84, 224, 21);
			}
			{
				jTextRazonSocial = new JTextField();
				getContentPane().add(jTextRazonSocial);
				jTextRazonSocial.setBounds(112, 120, 224, 21);
			}
			{
				jBAceptar = new JButton();
				getContentPane().add(jBAceptar);
				jBAceptar.setText("ACEPTAR");
				jBAceptar.setBounds(49, 203, 110, 28);
				jBAceptar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("jBAceptar.actionPerformed, event="
							+ evt);
						SistemaIndumentaria.getInstancia().agregarProveedor(Integer.parseInt(jTextIdProveedor.getText()), jTextCuit.getText(), jTextDireccion.getText(), jTextTelefono.getText(),jTextRazonSocial.getText());
						AltaProveedor.getInstance(true).setVisible(false);
					}
				});
			}
			{
				jBCancelar = new JButton();
				getContentPane().add(jBCancelar);
				jBCancelar.setText("CANCELAR");
				jBCancelar.setBounds(238, 203, 110, 28);
				jBCancelar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("jBCancelar.actionPerformed, event="
							+ evt);
						AltaProveedor.getInstance(true).setVisible(false);
					}
				});
			}
			pack();
			setSize(400, 300);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private void inicializarPantalla()
	{
	
		this.jTextCuit.setText("");
		this.jTextTelefono.setText("");
		this.jTextDireccion.setText("");
		this.jTextRazonSocial.setText("");
		//this.txtDireccion.setText("");
		//this.txtTelParticular.setText("");
		//this.txtFechaIngreso.setText("");
		//this.txtFechaNacimiento.setText("");
		//this.cargarTabla();
	}
	
	
	
}
